from tasks.models import TaskExecutionLog
import datetime

# 获取今天的任务执行日志
today = datetime.date.today()
logs = TaskExecutionLog.objects.filter(start_time__date=today)

print(f"今天的任务执行日志数量: {logs.count()}")

if logs:
    for log in logs:
        print(f"\n日志ID: {log.id}")
        print(f"开始时间: {log.start_time}")
        print(f"执行成功: {log.is_success}")
        print(f"日志内容前100字符: {log.log_content[:100] if log.log_content else '无'}")
        print(f"处理总数: {log.total_processed}")
        print(f"成功数量: {log.success_count}")
        print(f"失败数量: {log.failure_count}")

# 检查Celery配置
from celery import current_app
print("\n\nCelery已配置的定时任务:")
for task_name, task_config in current_app.conf.beat_schedule.items():
    print(f"任务名称: {task_name}")
    print(f"任务配置: {task_config}")
    print("---")